

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>登入 - 客户管理系统</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/usercp/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="/usercp/style/admin.css" media="all">
  <link rel="stylesheet" href="/usercp/style/login.css" media="all">
</head>
<body>

  <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="">
    <canvas id="demo-canvas" width="1920" height="320"></canvas>
    <div class="layadmin-user-login-main">
      <div class="layadmin-user-login-box layadmin-user-login-header">
        <h2>客户管理系统</h2>
        <p>一站式企业小程序解决方案</p>
      </div>
      <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
          <input type="text" name="account" id="LAY-user-login-username" lay-verify="required" placeholder="用户名" class="layui-input">
        </div>
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
          <input type="password" name="password" id="LAY-user-login-password" lay-verify="required" placeholder="密码" class="layui-input">
        </div>
        <div class="layui-form-item">
          <button class="layui-btn layui-btn-fluid" id="login_btn" lay-submit lay-filter="LAY-user-login-submit">登 入</button>
        </div>
      </div>
    </div>

  </div>
  <style>
    .layadmin-user-login {
      display: none;
      position: relative;
      width: 100%;
      overflow: hidden;
      background: url(/usercp/images/loginbg.jpg) no-repeat 100%/100%;
    }
    .layadmin-user-login-main {
      border-radius: 6px;
      box-shadow: #eee 1px 1px 2px;
      background-color: white;
      position: absolute;
      left: 50%;top: 50%;
      margin-top: -225px;
      margin-left: -200px;
    }
  </style>
  <script src="/usercp/layui/layui.js"></script> 
  <script src="/usercp/lib/canvas/TweenLite.min.js"></script>  
  <script src="/usercp/lib/canvas/EasePack.min.js"></script>
  <script src="/usercp/lib/canvas/canvas.js"></script>   
  <script>
  layui.config({
    base: '/usercp/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'user'], function(){
    var $ = layui.$
    ,setter = layui.setter
    ,admin = layui.admin
    ,form = layui.form
    ,router = layui.router()
    ,search = router.search;

    form.render();

    //绑定回车事件
    $(document).keydown(function (e) {
        if (e.keyCode === 13) {
          $("#login_btn").trigger("click");
        }
    });
    //提交
    form.on('submit(LAY-user-login-submit)', function(obj){
      //请求登入接口
      admin.req({
        url: '/usercp/login/do_login'
        ,type: 'post'
        ,data: obj.field
        ,success: function(res) {
          if (res.code == 0){
            layer.msg(res.msg, {
              offset: '15px'
              ,icon: 2
              ,anim: 6
              ,time: 1000
            }, function(){});
            return false;
          }
          
          //登入成功的提示与跳转
          layer.msg(res.msg, {
            offset: '15px'
            ,icon: 1
            ,time: 1000
          }, function(){
            location.href = res.url;
          });
        }
      });
      
    });
  });
  </script>
</body>
</html>